
package cn.edu.scau.cmi.chenzehan.ComprehensiveExperiment;

import cn.edu.scau.cmi.chenzehan.client.CombinationPattern;
import cn.edu.scau.cmi.chenzehan.client.MultipMode;
import cn.edu.scau.cmi.chenzehan.client.SinpleFactory;
import cn.edu.scau.cmi.chenzehan.client.UIHibernateFrame;
import cn.edu.scau.cmi.chenzehan.client.UiAbstractFactory;
import cn.edu.scau.cmi.chenzehan.client.UiClassAdapter;
import cn.edu.scau.cmi.chenzehan.client.UiFactory;
import cn.edu.scau.cmi.chenzehan.client.UiObjAdapter;
import cn.edu.scau.cmi.chenzehan.client.UiSpringFrame;
import cn.edu.scau.cmi.chenzehan.client.UisinglePattern;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;

public class MainView extends Application{

	
	private Parent root;
	private Button button1;
	private Button button2;
	private Button button3;
	private Button button4;
	private Button button5;
	private Button button6;
	private Button button7;
	private Button button8;
	private Button button9;
	private Button button10;
	private Button button11;
	
	private Stage stage = new Stage();
	

	
	@Override
	public void start(Stage primaryStage) throws Exception {
	    root = FXMLLoader.load(getClass().getResource("ComprehensiveExperiment.fxml"));
		button1 = (Button) root.lookup("#button1");
		button2 = (Button) root.lookup("#button2");
		button3 = (Button) root.lookup("#button3");
		button4 = (Button) root.lookup("#button4");
		button5 = (Button) root.lookup("#button5");
		button6 = (Button) root.lookup("#button6");
		button7 = (Button) root.lookup("#button7");
		button8 = (Button) root.lookup("#button8");
		button9 = (Button) root.lookup("#button9");
		button10 = (Button) root.lookup("#button10");
		button11 = (Button) root.lookup("#button11");

		
		
		button1.setOnAction(e->{
			
			try {
				UisinglePattern uisinglePattern = new UisinglePattern();
				uisinglePattern.start(stage);
			} catch (Exception e1) {
				e1.printStackTrace();
			}
		});
		
		button2.setOnAction(e->{
			
			try {
				MultipMode mode = new MultipMode();
				mode.start(stage);
			} catch (Exception e1) {
				e1.printStackTrace();
			}
		});
		
		button3.setOnAction(e->{
			
			try {
				SinpleFactory mode = new SinpleFactory();
				mode.start(stage);
			} catch (Exception e1) {
				e1.printStackTrace();
			}
		});
		
		button4.setOnAction(e->{
			
			try {
				UiFactory mode = new UiFactory();
				mode.start(stage);
			} catch (Exception e1) {
				e1.printStackTrace();
			}
		});
		
		button5.setOnAction(e->{
			
			try {
				UiAbstractFactory mode = new UiAbstractFactory();
				mode.start(stage);
			} catch (Exception e1) {
				e1.printStackTrace();
			}
		});
		
		button6.setOnAction(e->{
			
			try {
				UiObjAdapter mode = new UiObjAdapter();
				mode.start(stage);
			} catch (Exception e1) {
				e1.printStackTrace();
			}
		});
		
		button7.setOnAction(e->{
			
			try {
				UiClassAdapter mode = new UiClassAdapter();
				mode.start(stage);
			} catch (Exception e1) {
				e1.printStackTrace();
			}
		});
		
		button8.setOnAction(e->{
			
			try {
				CombinationPattern mode = new CombinationPattern();
				mode.start(stage);
			} catch (Exception e1) {
				e1.printStackTrace();
			}
		});
		button9.setOnAction(e->{
			
			try {
				CombinationPattern mode = new CombinationPattern();
				mode.start(stage);
			} catch (Exception e1) {
				e1.printStackTrace();
			}
		});
		
		button10.setOnAction(e->{
			
			try {
				UIHibernateFrame mode = new UIHibernateFrame();
				mode.start(stage);
			} catch (Exception e1) {
				e1.printStackTrace();
			}
		});
		
		button11.setOnAction(e->{
			
			try {
				UiSpringFrame mode = new UiSpringFrame();
				mode.start(stage);
			} catch (Exception e1) {
				e1.printStackTrace();
			}
		});
		
		
		
		Scene scene = new Scene(root);
		primaryStage.setTitle("综合性实验");
		primaryStage.setScene(scene);
		primaryStage.show();
	}

	public static void main(String[] args) {
		
		launch(args);
	}
}
